package com.xique.door.service.impl.wechat;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xique.door.bean.domain.WxAutoReply;
import com.xique.door.mapper.WxAutoReplyMapper;
import com.xique.door.service.wechat.IWxAutoReplyService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: xq-cloud
 * @ClassName WxAutoReplyServiceImpl
 * @description:
 * @author: HdongSun
 * @create: 2022-09-30 09:11
 **/
@Service
@RequiredArgsConstructor
public class WxAutoReplyServiceImpl extends ServiceImpl<WxAutoReplyMapper, WxAutoReply> implements IWxAutoReplyService {

    private final WxAutoReplyMapper wxAutoReplyMapper;

    @Override
    public List<WxAutoReply> selectListByKeyword(String keyword) {
        if (StrUtil.isEmpty(keyword)) {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<WxAutoReply> condition = Wrappers.lambdaQuery();
        condition.like(WxAutoReply::getKeyword, keyword);
        return wxAutoReplyMapper.selectList(condition);
    }
}
